#include "Wandering.h"

//static float k = 10;

const Proximity_dir Wandering::randTileTo()
{
	//Sleep(k);
	srand((unsigned)time(&SEED_MOVE));
	return (Proximity_dir)(rand() % PROXIMITY_COUNT);//c-style casting is evil!! I know that much
}


void Wandering::perform(Character* movingAgent, const Background* bg)
{
	Proximity_dir	   random = randTileTo();
	BackgroundElement* tileTo = movingAgent->mAdjacentTiles[random];

	if(tileTo->isWalkable())
	{
		setFacing(random);
		movingAgent->moveTo(bg, tileTo);
	}
}

void Wandering::reset()
{
	SEED_MOVE = time(NULL);
	//wait(1.0F);
}